# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=hwdata
pkgver=0.377.2
_pkgver=0.377-2
pkgrel=0
pkgdesc="Hardware identification and configuration data"
url="https://github.com/vcrhonek/hwdata"
arch="noarch"
license="GPL-2.0-or-later OR XFree86-1.1"
subpackages="$pkgname-dev $pkgname-usb $pkgname-pci $pkgname-pnp $pkgname-net"
source="$pkgname-$pkgver.tar.gz::https://github.com/vcrhonek/hwdata/archive/refs/tags/v$_pkgver.tar.gz"
options="!check" # just firmware data

replaces="hwids"
# be higher since hwids was a large date version
provides="hwids=20220101-r$pkgrel"
builddir="$srcdir/$pkgname-$_pkgver"

build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--disable-blacklist
}

package() {
	depends="
		$pkgname-usb=$pkgver-r$pkgrel
		$pkgname-pci=$pkgver-r$pkgrel
		$pkgname-pnp=$pkgver-r$pkgrel
		$pkgname-net=$pkgver-r$pkgrel
		"
	make -j1 DESTDIR="$pkgdir" install
}

dev() {
	default_dev
	depends="$pkgname=$pkgver-r$pkgrel"
}

usb() {
	pkgdesc="$pkgdesc (usb data)"
	provides="hwids-usb=20220101-r$pkgrel"
	replaces="hwids-usb"

	amove usr/share/hwdata/usb.ids
}

pci() {
	pkgdesc="$pkgdesc (pci data)"
	provides="hwids-pci=20220101-r$pkgrel"
	replaces="hwids-pci"

	amove usr/share/hwdata/pci.ids
}

net() {
	pkgdesc="$pkgdesc (net data)"
	provides="hwids-net=20220101-r$pkgrel"
	replaces="hwids-net"

	amove usr/share/hwdata/oui.txt
	amove usr/share/hwdata/iab.txt
}

pnp() {
	pkgdesc="$pkgdesc (pnp data)"

	amove usr/share/hwdata/pnp.ids
}

sha512sums="
c22be7ded7277cbf00300251dca061d2d34f01afc0283b3821649c382b66d74c06dcf66976c48e47879d3077e9b5dcbf01c4fbce3cc9b513ac01e5a05fc24d88  hwdata-0.377.2.tar.gz
"
